<template>
 <div class="ordering">
     <div class="heading">班级列表</div>
     <div>
        <div class="MBTI-user">
             <el-input v-model="classID" size="small" placeholder="输入班级" class="inptflex"/>
             <el-button type="primary" size="small" @click="select">查找</el-button>
        </div>
       
        <el-table :data="classdata" style="width: 100%" :stripe = "true">
            
            <el-table-column prop="classID" label="班号" min-width="100" align="center" />
            <el-table-column prop="StudentID" label="学号" min-width="100" align="center" />
            <el-table-column prop="time" label="测试时间" min-width="100" align="center"/>
            <el-table-column prop="MBTIcode" label="MBTI_CODE" min-width="100" align="center"/>
        </el-table>
        <!-- 分页 -->
         <!-- <el-pagination background layout="prev, pager, next" :total="50" /> -->
         <!-- 搜索 -->
        
        
        
    </div>
 </div>

</template>

<script>
import { ElMessage } from 'element-plus'
import { reactive ,toRefs,getCurrentInstance, ref} from 'vue'
export default{
    setup(){
        const {proxy} = getCurrentInstance()

        const user = reactive({
            classID: '',
         
        })

      
        const classdata = ref([{
                ClassID: '',
                MBTIcode: '',
                time: '',
                StudentID: '',
    }])

        const select = async () => {

            const obj2 = {
                 classID: user.classID,
            }

            try {
                
                const res_class = await new proxy.$request(proxy.$urls.m().class_result, obj2).modepost()
                
                if (res_class.status = 200) {
                    classdata.value = res_class.data.ClassList
                    console.log(classdata)
                } else {
                    ElMessage('请重新输入')
                }

            } catch (e) {
                // new proxy.$tips('服务器错误').message()
            }


        }
        return{  classdata, ...toRefs(user),select,proxy}
    }
}


</script>



<style></style>






